package com.spa.application.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.spa.application.dto.common.rule.RuleDto;
import com.spa.domain.entity.Rule;

import java.util.List;

/**
 * excel导出转换上下架 规则
 */
public class RuleConverter implements Converter<List<RuleDto>> {


    @Override
    public Class<?> supportJavaTypeKey() {
        return List.class;
    }

    @Override
    public WriteCellData<String> convertToExcelData(List<RuleDto> value, ExcelContentProperty contentProperty,
                                                    GlobalConfiguration globalConfiguration) {
        String str = Rule.ruleDtoListToStr(value);
        return new WriteCellData<String>(str);
    }
}